"""
首页
"""

from sanic.response import html
from sanic.views import HTTPMethodView
from sanic_ext import openapi


DEFAULT_INDEX = '''
<html>
  <head>
    <title>GBCMS</title>
  </head>
  <body>
    <div style="text-align: center; margin-top: 200px;">
      <div style="width: 245px;margin: 0 auto;">
        <img src="/logo.png" alt="首页" />
     </div>
     <br>
      <h1>
        Welcome GlobalBusinessChain Management System !
      </h1>
      <h2>
        <a href="/docs/swagger">Docs Swagger</a>
      </h2>
      <h2>
        <a href="/docs/redoc">Docs Redoc</a>
      </h2>
      <h2>
        <a href="/ui/index.html">WEB UI</a>
      </h2>
    </div>
  </body>
</html>
'''


class IndexView(HTTPMethodView):
    """
    首页类视图
    """
    @openapi.definition(
        tag='首页',
        description='index page',
        parameter=[]
    )
    def get(self, request):
        """
        首页
        """
        return html(DEFAULT_INDEX)
